package _12选择排序;

import java.util.Arrays;

public class Demo {
    public static void main(String[] args) {
        int[] arr ={5,3,1,2};

        //外循环表示循环的轮数
        for (int i = 0; i < arr.length - 1; i++) {
            for (int j = i+1; j < arr.length; j++) {
                if (arr[i]>arr[j]){
                    int temp = arr[j];
                    arr[j]=arr[i];
                    arr[i]=temp;
                }
            }
        }
        System.out.println(Arrays.toString(arr));

    }
}
